const router = require("koa-router")();

const {
    ruleApi
} = require("../../../controller/user/rule")

const { check } = require("../../../middleware/routercheck")

const { veri } = require("../../../middleware/checkData")

// // router.get("/role",getRoleApi)
// router.get("/role",getRoleApi)
router.get(
    "/rule/byid/:id",
    veri(["id"], "Non empty", "params"),
    check("getrule"),
    ruleApi)
router.get(
    "/rule/onlyname",
    check("getrule"),
    ruleApi)
router.get(
    "/rule/list",
    check("getrule"),
    ruleApi)
router.post(
    "/rule/create",
    veri(["rulename", "summary"], "Non empty", "request"),
    check("createrule"),
    ruleApi)
router.put(
    "/rule/edit/:id",
    veri(["id"], "Non empty", "params"),
    check("rule", "editrule"),
    ruleApi)
router.delete(
    "/rule/remove/:id",
    veri(["id"], "Non empty", "params"),
    check("removerule"),
    ruleApi)

module.exports = router;